


    ## WinBUGS code for a Varying-Intercept Model with Congress-Level Predictor  
    
    model {
    for (i in 1:N){
        Y[i] ~ dnorm(mu.y[i], tau.y)
        mu.y[i] <- alpha[congress[i]] + 
                   beta[1]*X1[i] + 
                   beta[2]*X2[i] + 
                   beta[3]*X3[i] + 
                   beta[4]*X4[i] +
                   beta[5]*X5[i] +
                   beta[6]*X1[i]*X2[i] +
                   beta[7]*X1[i]*X3[i] +
                   beta[8]*X1[i]*X4[i] +
                   beta[9]*X1[i]*X5[i] +
                   beta2[congress[i]]*X6[i]
        }

        # priors
        for (i in 1:n.beta){
        beta[i] ~ dnorm(0, 0.1)
        }
        tau.y <- pow(sigma.y, -2)
        sigma.y ~ dunif(0, 100)
        
        for (j in 1:J){
        beta2[j] ~ dnorm(0, 0.1)
        alpha[j] ~ dnorm(mu.alpha[j], tau.alpha)
        mu.alpha[j] <- gamma[1] + 
                       gamma[2]*Z1[j] + 
                       gamma[3]*Z2[j] + 
                       gamma[4]*Z3[j] + 
                       gamma[5]*Z4[j] +
                       gamma[6]*Z5[j]                  
        }

        # priors
        for (i in 1:n.gamma){
        gamma[i] ~ dnorm(0, 0.1)
        }
        tau.alpha <- pow(sigma.alpha, -2)
        sigma.alpha ~ dunif(0, 100)
    }

